package cn.xyy.system.service;

import cn.xyy.system.dao.LogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.xyy.common.utils.DateUtils;
import cn.xyy.common.exception.SystemException;
import cn.xyy.common.domain.mvc.Page;
import cn.xyy.common.domain.system.log.SysLog;
import cn.xyy.common.domain.system.log.SysLogVO;

/**
 * 日志业务层
 * 
 * @author xyy
 *
 */
@Service
public class LogService {
	@Autowired
	private LogDao logDao;

	public Page<SysLog> getListPage(SysLogVO vo) {
		if (vo == null) {
			throw new SystemException("参数不能为空");
		}
		if (vo.getStarttime() == null || vo.getEndtime() == null) {
			vo.setStarttime(DateUtils.getDate());
			vo.setEndtime(DateUtils.getDate());
		}
		return logDao.selectPage(vo);
	}

	public void save(SysLog log) {
		logDao.insert(log);
	}

}
